home *** CD-ROM | disk | FTP | other *** search
- Path: ux4.cso.uiuc.edu!djhoward
- From: djhoward@ux4.cso.uiuc.edu (howard daniel joseph)
- Newsgroups: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Subject: Re: How do I define my integers?
- Followup-To: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Date: 18 Jan 1996 19:57:48 GMT
- Organization: University of Illinois at Urbana
- Approved: Mu
- Message-ID: <4dm8ns$5kl@vixen.cso.uiuc.edu>
- References: <4d73ug$25v@vixen.cso.uiuc.edu> <30FD580D.4731@coewl.cen.uiuc.edu> <4djs0k$rub@vixen.cso.uiuc.edu>
- NNTP-Posting-Host: dclsn34.cen.uiuc.edu
- To: uiuc-class-cs110c@ux1.cso.uiuc.edu
- X-Newsreader: TIN [version 1.2 PL2]
- Status: R
- Content-Length: 1410
-
- Ted Liu (dcn@uiuc.edu) wrote:
- : In article <30FD580D.4731@coewl.cen.uiuc.edu>, m-han3 says...
- : >howard daniel joseph wrote:
- : >> Can I perform simple maths (addition, division) between integers of
- : >> different types? I'd assume so, right?
-
- : >Yes, you can. But they will be converted according to the order of the
- : >evaluation of the expression. You may lose precision sometimes.
-
- : I thought when u perform some arithmetic on numbers of different types the
- : smaller type is upgraded (like if u add an int and a float, the int is
- : upgraded to a float before the arithmetic operation). No precision would be
- : lost. Is this correct?
-
- Most responses I've received have said that ints of lower byte
- count are promoted to higher byte count ... though operative order may
- affect this if ie your adding the value of a long to a short ... why
- bother promoting the short to a long when all you want is a short?
- (Keeping stupid people from overflowing the short perhaps, but you
- needn't add a long to do that ...)
-
- --
- =====///====================================================================
- ====///=======This message brought to you by dannyman@uiuc.edu==============
- \\\///=========HOME PAGE! http://www.uiuc.edu/ph/www/djhoward ==============
- =\XX/A1200==================================================================
- My views are my own, and not those of my employer or UIUC. Happy Jim?
-
-